<template>
	<view class="page__bd">
		<custom-navbar :transparent="true" :top="scrollTop" :isBack="true" :isTitle="true">
			<block slot="title">详情展示</block>
			<block slot="right">
				<view class="daui-navbar__hd roundIcon" @tap.stop="openTopmenu">
					<text class="iconfontzz icon-gengduo-tianchong"></text>
				</view>
			</block>
		</custom-navbar>
		
		<!-- 图片轮播 -->
		<view class="bg-white" :style="[{height:StatusBar + 'px'}]"></view>
		<view class="swiper-box">
			<swiper class="daui-swiper" :indicator-dots="false" :circular="true" :autoplay="true" :interval="5000" duration="500" @change="swiperChange" :style="{'height':productSwiperHeight+'px'}">
				<swiper-item v-for="(item,index) in pictureList" :key="index">
					<image :src="item.picurl_show" mode="scaleToFill"></image>
				</swiper-item>
			</swiper>
			<view class="swiper-tag">
				<view class="daui-badge radius bg-white">{{swiperCur+1}}/{{pictureList.length}}</view>
				<view class="cu-tag round vide-tag" @click="showModal" data-target="videoShow" v-if="0">
					<text class="icon-videofill margin-right-xs"></text>
					00'40"
				</view>
			</view>
		</view>
	
		<!-- 商品头部 -->
		<view class="daui-card daui-card_full zzui-card goods-head">
			<view class="daui-card__bd daui-card__bd-padding">
				<view class="daui-media__title">{{productInfo.name}}</view>
				<view class="goods-price">
					<text class="text-pricered">
						<text>￥</text>
						<text class="goods-real-price">{{productInfo.real_price}}</text>
					</text>
					<text class="origin-price">¥{{productInfo.origin_price}}</text>
					<!--
					<view class="pro-original-price text-grayDark" v-if="0">
						价格
						<text class="text-price text-del">{{productInfo.origin_price}}</text>
						<text class="pro-stock">仅剩{{productInfo.stock_num}}件</text>
					</view>
					-->
				</view>
				<view class="daui-flex goods-stock">
					<view class="daui-flex__item">销量：{{productInfo.sale_num}}</view>
					<view class="daui-flex__item">库存：{{productInfo.stock_num}}</view>
					<view class="daui-flex__item">浏览量：{{productInfo.hit_num}}</view>
				</view>
			</view>
		</view>
	
		<!-- 商品头 -->
		<view class="pro-head" v-if="0">
			<view class="pro-pricebox">
				<view class="pro-price">
					<view v-if="productInfo.is_visible">
						<text>￥</text>
						<text class="pro-real-price">{{realPriceArr[0]}}</text>
						<text>.{{realPriceArr[1]}}</text>
					</view>
					<view v-else>{{productInfo.real_price}}</view>
				</view>
				<view class="pro-collection" :class="isCollect ? 'text-red' : ''" @click="doCollect">
					<view class="iconfontzz" :class="isCollect ? 'icon-likefill' : 'icon-like'"></view>
					<view class="pro-scale-collection">收藏</view>
				</view>
			</view>
			<view class="pro-original-price text-grayDark">
				价格
				<text class='text-price text-del'>{{productInfo.origin_price}}</text>
				<text class="pro-stock">仅剩{{productInfo.stock_num}}件</text>
			</view>
			<view class="pro-titbox">
				<view class="pro-title">{{productInfo.name}}</view>
				<!-- #ifdef MP-WEIXIN -->
				<button class="pro-share-btn pro-share-position" open-type="share">
					<view class="daui-tag daui-tag_default">
						<view class="pro-share-box">
							<text class="iconfontzz icon-fenxiang3"></text>
							<text class="pro-share-text">分享</text>
						</view>
					</view>
				</button>
				<!-- #endif -->
				<!-- #ifndef MP-WEIXIN -->
				<button class="pro-share-btn pro-share-position" @click="onShare">
					<view class="daui-tag daui-tag_default">
						<view class="pro-share-box">
							<text class="iconfontzz icon-fenxiang3"></text>
							<text class="pro-share-text">分享</text>
						</view>
					</view>
				</button>
				<!-- #endif -->
			</view>
		</view>
		
		<!-- 规格选择 -->
		<view class="cu-list menu margin-top-sm" @tap="showTypeModal('type')" style="display: none;">
			<view class="cu-item arrow">
				<view class="content text-df">规格选择</view>
			</view>
			<view class="cu-item arrow" style="display:none">
				<view class="content text-df">领取优惠券</view>
			</view>
		</view>
		
		<!-- 评价 -->
		<view class="cu-bar bg-white margin-top" style="display: none;">
			<view class="action">
				<text class="icon-titles text-orange"></text>
				<text>用户好评({{productInfo.evaluation_num}})</text>
			</view>
			<navigator url="/pages/product/evaluation" class='action text-df text-gray' hover-class="none">更多 <text class="iconfontzz icon-youjiantou"></text></navigator>
		</view>
		<view class="cu-card dynamic no-card">
			<view class="cu-item solid-top" v-for="(item, index) in evaluationList" :key="id">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10006.jpg);"></view>
						<view class="content flex-sub">
							<view>
								<view class="text-cut" style="width: 200upx">
									wenxiaoasdsadsa
								</view>
								<view class="margin-left-xs">
									<text v-for="(star,rating) in 5" :key="rating" :class="rating<3?'icon-favorfill text-orange':'icon-favor text-gray'"></text>
								</view>
							</view>
							<view class="text-gray text-sm flex justify-between">
								规格：【XL 80-100斤】 颜色：893黑色
							</view>
						</view>
					</view>
				</view>
				<view class="text-content">
					{{item.content}}
				</view>
				<view class="grid flex-sub padding-lr col-3 grid-square padding-bottom">
					<view class="bg-img" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10006.jpg);"
					 v-for="(item,index) in 5" :key="index">
					</view>
				</view>
			</view>
		</view>
	
		<view class="daui-card daui-card_full" v-if="0">
			<view class="daui-card__bd goods-parameter">
				<view class="daui-cell">
					<view class="daui-cell__hd">品&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;牌：</view>
					<view class="daui-cell__bd">{{productInfo.brand_name}}</view>
				</view>
				<view class="daui-cell">
					<view class="daui-cell__hd">产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;地：</view>
					<view class="daui-cell__bd">{{productInfo.originplace}}</view>
				</view>
				<view class="daui-cell">
					<view class="daui-cell__hd">分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类：</view>
					<view class="daui-cell__bd">{{productInfo.category_name}}{{productInfo.sub_category_name}}</view>
				</view>
				<view class="daui-cell">
					<view class="daui-cell__hd">包装方式：</view>
					<view class="daui-cell__bd">{{productInfo.package}}</view>
				</view>
				<view class="daui-cell">
					<view class="daui-cell__hd">重&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量：</view>
					<view class="daui-cell__bd">{{productInfo.weight}}kg</view>
				</view>
			</view>
		</view>
		
		<view class="daui-card daui-card_full goods-content">
			<view class="daui-card__bd">
				<view class="goods-cont-title"><text>图文详情</text></view>
				<mp-html :content="productInfo.content" lazy-load="true" :tag-style="tagStyle">商品详情展示</mp-html>
			</view>
		</view>
		
		<!-- 底部操作条 -->
		<view class="daui-tabbar daui-tabbar-fixed foot border daui-tabbar-cart" v-if="productInfo.affiliate_isopen">
			<button class="daui-tabbar__hd" @click="openIndex">
				<view class="iconfontzz icon-homepage"></view><view>首页</view>
			</button>
			<view class="daui-tabbar__hd" @click="showPoster">
				<view class="iconfontzz icon-fenxiangzhuanshouyi"></view>
				赚{{productInfo.affiliate_amount}}元
			</view>
			<view class="daui-tabbar__hd" @tap="openCart">
				<view class="iconfontzz icon-cart1e"></view><view>购物车</view>
				<view class="daui-badge" v-if="site_cart_buy_num > 0">{{site_cart_buy_num}}</view>
			</view>
			<view class="daui-tabbar__hd" @click="openMine" v-if="0">
				<view class="iconfontzz icon-wo"></view>
				我的
			</view>
			<view class="daui-tabbar__hd daui-tabbar__hdbtn">
				<view class="daui-btngroup">
					<button class="daui-btn daui-btn_plain-danger" @tap="showPopup" data-type="cart">加入购物车</button>
					<button class="daui-btn" @tap="showPopup" data-type="buy">立即购买</button>
				</view>
			</view>
		</view>
		<view class="daui-tabbar daui-tabbar-fixed foot border daui-tabbar-cart" v-else>
			<view class="daui-tabbar__hd" @tap="openIndex">
				<view class="iconfontzz icon-shop"></view><view>店铺</view>
			</view>
			<view class="daui-tabbar__hd" @tap="openCart">
				<view class="iconfontzz icon-cart1e"></view><view>购物车</view>
				<view class="daui-badge" v-if="site_cart_buy_num > 0">{{site_cart_buy_num}}</view>
			</view>
			<view class="daui-tabbar__hd text-red" @tap="doCollect" v-if="isCollect">
				<view class="iconfontzz icon-favor_fill"></view><view>收藏</view>
			</view>
			<view class="daui-tabbar__hd" @tap="doCollect" v-else>
				<view class="iconfontzz icon-favor"></view><view>收藏</view>
			</view>
			<view class="daui-tabbar__hd" v-if="0">
				<button open-type="contact" class="btn-contact">
					<view class="iconfontzz icon-service"></view><view>客服</view>
				</button>
			</view>
			<view class="daui-tabbar__bd"></view>
			<view class="daui-tabbar__hd daui-tabbar__hdbtn">
				<view class="daui-btngroup">
					<button class="daui-btn daui-btn_plain-danger" @tap="showPopup" data-type="cart">加入购物车</button>
					<button class="daui-btn" @tap="showPopup" data-type="buy">立即购买</button>
				</view>
			</view>
		</view>
		<view class="daui-tabbar-height"></view>
		
		<!-- 选择商品规格 -->
		<uni-popup ref="specbox" type="bottom">
			<specificationsnew @submitCart="submitCart" @submitBuy="submitBuy" :productInfo="productInfo" :gspecList="gspecList" :cartType="cartType"  @hidePopup="hidePopup" v-if="specOnLoad == 1"></specificationsnew>
		</uni-popup>
		
		<!-- 分享海报 -->
		<uni-popup ref="sharePoster" type="bottom" :maskClick=true>
			<view class="poster-box">
				<view class="poster-box-hd" @click="hidePoster">
					<image :src="ewmimgurl" mode="widthFix" class="poster-img"></image>
				</view>
				<view class="poster-box-bd">
					<!-- #ifdef MP-WEIXIN -->
					<view class="daui-btn bg-gradual-red round shadow block margin-right-sm" open-type="share">分享好友</view>
					<view class="daui-btn bg-gradual-red round shadow block" @click="doSave">保存海报</view>
					<!-- #endif -->
					<!-- #ifdef APP-PLUS -->
					<view class="daui-btn bg-gradual-red round shadow block margin-right-sm" @click="onShare">分享好友</view>
					<view class="daui-btn bg-gradual-red round shadow block" @click="doSave">保存海报</view>
					<!-- #endif -->
					<!-- #ifdef H5 -->
					<view class="daui-btn bg-gradual-red round shadow block margin-right-sm" @click="onShare">分享好友</view>
					<view class="daui-btn bg-gradual-red round shadow block">长按二维码保存</view>
					<!-- #endif -->
				</view>
			</view>
		</uni-popup>
		
		<!--顶部下拉菜单-->
		<uni-popup ref="topmenuPopup" type="top">
			<view class="tui-dropdown-box">
				<view class="tui-menu-box tui-padding tui-ptop">
					<view class="tui-menu-header">功能直达</view>
					<view class="tui-menu-itembox">
						<block v-for="(item, index) in topMenu" :key="index">
							<view class="tui-menu-item" hover-class="tui-opcity" :hover-stay-time="150" @tap="btnTopMenu(index)">
								<view class="tui-badge-box">
									<text class="iconfontzz" :class="item.icon"></text>
									<view class="daui-badge round" v-if="item.badge > 0">{{item.badge}}</view>
								</view>
								<view class="tui-menu-text">{{item.text}}</view>
							</view>
						</block>
					</view>
					<view class="tui-icon-up_box">
						<text class="iconfontzz icon-roundclose" @click="closeMenu"></text>
					</view>
				</view>
			</view>
		</uni-popup>
		
		<!-- 分享弹窗 -->
		<uni-popup ref="sharePopup" type="bottom">
			<share-btn :sharedataTemp="sharedata"></share-btn>
		</uni-popup>
		
		<!--toast提示-->
		<daui-toast ref="toast"></daui-toast>
	</view>
	</template>
	
	<script>
	import danceuiTool from '../../utils/danceuiTool';
	import http from "../../server/api-product.js";
	import specificationsnew from '@/components/specificationsnew/specificationsnew';
	import mpHtml from '@/components/mp-html/mp-html';
	import uniPopup from '../../components/uni-popup/uni-popup.vue';
	import shareBtn from '../../components/share-btn/share-btn.vue';
	export default {
		components: {
			specificationsnew,
			mpHtml,
			uniPopup,
			shareBtn
		},
		data() {
			return {
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				shareInfo: {}, //分享数据
				sharedata: {
					type: 1,
					strShareTitle: "分享标题",
					strShareSummary: "分享总结",
					strShareUrl: "",
					strShareImageUrl: ""
				},
				tagStyle: {},
				scene: '',
				uid: 0,
				moonInfo: {},
				ewmimgurl: '',
				top: 26, //标题图标距离顶部距离
				code: '',
				codeurl: '',
				scrollTop: 0,
				ModalClose: this.CustomBar + 35 + uni.upx2px(690),
				modalName: null,
				swiperCur: 0,
				productInfo: {
					brand_name: '',
					originplace: '',
					category_name: '',
					sub_category_name: '',
					package: '',
					weight: ''
				},
				shopInfo: {},
				realPriceArr: [],
				specOnLoad: 0,
				cartType: '',
				gspecList: {}, //商品sku信息
				pictureList: [],
				product_swiper_ratio: 0,
				productSwiperHeight: 0,
				evaluationList: [],
				followShow: '',
				isCollect: 0,
				collectShow: '',
				site_cart_buy_num: 0,
				cartBuyNum: 0,
				topMenu: [
					// {
					// 	icon: 'icon-xiaoxi4',
					// 	text: '消息',
					// 	size: 26,
					// 	badge: 0
					// },
					{
						icon: 'icon-home',
						text: '首页',
						size: 23,
						badge: 0
					},
					{
						icon: 'icon-people',
						text: '我的',
						size: 26,
						badge: 0
					},
					{
						icon: 'icon-shopcart',
						text: '购物车',
						size: 23,
						badge: 0
					},
					{
						icon: 'icon-service',
						text: '客服',
						size: 26,
						badge: 0
					},
					{
						icon: 'icon-edit',
						text: '我要反馈',
						size: 23,
						badge: 0
					},
					{
						icon: 'icon-share',
						text: '分享',
						size: 26,
						badge: 0
					}
				],
				popupShow: false,
				TypeModal: 'type'
			}
		},
		onLoad(options) {
			console.log('onLoad的参数:', options);
			this.pid = options.pid;
			this.scene = options.scene ? options.scene : '';
			
			// options 中的 scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
			var scene = decodeURIComponent(options.scene);
			var sceneObj = {};
			for (var i = 0; i < scene.split('&').length;i++){
				var arr = scene.split('&')[i].split('=');
				sceneObj[arr[0]] = arr[1];
			}
			console.log('sceneObj:', sceneObj);
			
			this.setAffiliate(sceneObj.fromuid);
			
			if(sceneObj.pid){
				this.pid = sceneObj.pid;
			}
			
			this.list_param = {pid: this.pid};
			this.getData();
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
			if (e.scrollTop < 0) {
				this.topImgH = 0 - e.scrollTop + 200
			} else {
				this.topImgH = 200
			}
			if (e.scrollTop > 200 + uni.upx2px(354) - this.CustomBar) {
				this.fixed = true;
			} else {
				this.fixed = false;
			}
		},
		onShareAppMessage(res) { //发送给朋友
			if (res.from === "button") { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: this.shareInfo.title,
				path: this.shareInfo.path,
				imageUrl: this.shareInfo.icon,
				desc: this.shareInfo.desc
			}
		},
		onShareTimeline(res) { //分享到朋友圈
			return {
				title: this.shareInfo.title,
				path: this.shareInfo.path,
				imageUrl: this.shareInfo.icon,
				desc: this.shareInfo.desc
			}
		},
		methods: {
			setAffiliate(fromuid) { //设置分销关系
				console.log('上级分销关系：', fromuid);
				if(fromuid){
					uni.setStorage({
						key: 'storage_affiliateUid',
						data: fromuid
					})
				}
			},
			showModal(e){
				this.modalName = e.currentTarget.dataset.target
			},
			hideModal(e){
				this.modalName = null
			},
			async getData(){ //请求并获取数据
				const token = uni.getStorageSync('token');
				let headers = {"Authorization":"Bearer "+token};
				let ret = await http.productDetail(this.$refs.toast, this.list_param, headers, 1);
				console.log('productDetail页面，获取到的数据：', ret);
				var retData = ret.data;
				this.moonInfo = retData.moonInfo;
				this.site_cart_buy_num = retData.site_cart_buy_num;
				this.topMenu[2].badge = retData.site_cart_buy_num;
				this.shareInfo = retData.shareInfo;
				if(retData.shareInfo){
					this.sharedata.strShareTitle = retData.shareInfo.title;
					this.sharedata.strShareSummary = retData.shareInfo.desc;
					this.sharedata.strShareUrl = retData.shareInfo.link;
					//#ifdef MP-WEIXIN
					this.sharedata.strShareUrl = retData.shareInfo.mplink;
					//#endif
					if(retData.shareInfo.icon){
						this.sharedata.strShareImageUrl = retData.shareInfo.icon;
					}
				}
				this.productSwiperHeight = this.windowWidth * retData.product_swiper_ratio; //图片高度计算
				console.log('图片轮播高度productSwiperHeight:'+this.productSwiperHeight);
				this.pictureList = retData.pictureList;
				this.evaluationList = retData.evaluationList;
				var tmpArr = retData.productInfo.real_price.split('.');
				//console.log('realPriceArr:', tmpArr);
				this.realPriceArr = tmpArr;
				this.productInfo = retData.productInfo;
				console.log('商品信息:', retData.productInfo);
				this.isCollect = this.productInfo.isCollect;
				this.shid = retData.productInfo['shid'];
				this.shopInfo = retData.shopInfo;
				console.log('specinfoList:', retData.specinfoList);
				console.log('specList:', retData.specList);
				if(retData.productInfo.spec_isopen == 1){
					this.gspecList = {
						spec_info_list: retData.specinfoList,
						goods_spec: retData.specList
					}
				}else{
					this.gspecList = {}
				}
				this.specOnLoad = 1;
				console.log('gspecList:', this.gspecList);
				//this.specTitleList = retData.specTitleList;
				//this.specList = retData.specList;
			},
			swiperChange(e) {
				this.swiperCur = e.detail.current
			},
			showTypeModal(e) {
				this.modalName = 'typeModal'
				this.TypeModal = e
			},
			/**
			 * 显示规格弹窗
			 */
			showPopup: function(e) {
				console.log('显示规格弹窗,type:', e.target.dataset.type);
				this.cartType = e.target.dataset.type;
				this.$refs.specbox.open();
				//this.popupShow = true;
				// if(JSON.stringify(this.productInfo)!='{}' && JSON.stringify(this.gspecList)!='{}'){
				// 	//this.$refs.mychild.toggleSpec();
				// 	this.popupShow = true;
				// }else{
				// 	uni.showToast({
				// 		title: '数据不正确，请稍后再试',
				// 		mask: false,
				// 		duration: 1500
				// 	});
				// }
			},
			/**
			 * 隐藏规格弹窗
			 */
			hidePopup: function() {
				this.$refs.specbox.close();
			},
			/**
			 * 父元素接受子元素（规格）
			 */
			async submitCart(pid, specId, buyNum){ //请求并获取数据,提交事件
				console.log('加入购物车,商品ID:'+pid+';规格ID:'+specId+';购买数量:'+buyNum);
				const token = uni.getStorageSync('token');
				var headers = {"Authorization":"Bearer "+token};
				var param = {
					initPid: pid,
					initSpecId: specId,
					buyOrAdd: 2,
					initBuyNum: buyNum
				};
				let ret = await http.doAddAndUpdateCart(this.$refs.toast, param, headers);
				if(ret.code == 200){
					var retData = ret.data;
					this.$refs.specbox.close();
					this.cartBuyNum = retData.cartBuyNum;
					this.topMenu[3].badge = retData.cartBuyNum;
				}
			},
			async submitBuy(specId, buyNum){ //提交事件
				console.log('直接购买,规格ID:', specId, '购买数量:', buyNum);
				const token = uni.getStorageSync('token');
				var headers = {"Authorization":"Bearer "+token};
				var param = {
					initShid: this.shid,
					initPid: this.pid,
					initSpecId: specId,
					initBuyNum: buyNum
				};
				let ret = await http.doBuyVerify(this.$refs.toast, param, headers);
				console.log('doBuyVerify操作，获取到的数据：', ret);
				if(ret.code == 200){
					var retData = ret.data;
					uni.navigateTo({
						url: '/pages/order/orderPrepair?initMode=1&initShid='+this.shid+'&initPid='+this.pid+'&initSpecId='+specId+'&initBuyNum='+buyNum
					})
				}
			},
			openProductEvaluation(){
				uni.navigateTo({
					url: '/pagesA/product/productEvaluation?pid='+this.pid
				});
			},
			openShopDetail(){
				uni.navigateTo({
					url: '/pages/shop/shopDetail?shid='+this.productInfo.shid
				});
			},
			openIndex(){
				uni.switchTab({
					url: '/pages/index/index'
				});
			},
			openCart(){
				uni.switchTab({
					url: '/pages/cart/cart'
				});
			},
			openMine(){
				uni.switchTab({
					url: '/pages/mine/mine'
				});
			},
			onShare(){
				this.$refs.sharePopup.open();
			},
			bannerChange: function(e) {
				this.bannerIndex = e.detail.current;
			},
			previewImage: function(e) {
				let index = e.currentTarget.dataset.index;
				uni.previewImage({
					current: this.banner[index],
					urls: this.banner
				});
			},
			back: function() {
				uni.navigateBack();
			},
			openTopmenu: function() {
				this.$refs.topmenuPopup.open();
			},
			closeMenu: function() {
				this.$refs.topmenuPopup.close();
			},
			async showPoster(){ //请求并获取数据,显示分享海报
				const token = uni.getStorageSync('token');
				let headers = {"Authorization":"Bearer "+token};
				var param = {
					pid: this.pid
				};
				param.platform = 'h5';
				// #ifdef APP-PLUS
				param.platform = 'appPlus';
				// #endif
				// #ifdef MP-WEIXIN
				param.platform = 'mpWeixin';
				// #endif
				let ret = await http.showPoster(this.$refs.toast, param, headers, 1);
				var retData = ret.data;
				console.log('展示分享海报showPoster，获取到的数据：', retData);
				if(typeof retData != "undefined"){
					console.log(retData.flag);
					// #ifdef H5
					//this.ewmurl = danceuiTool.apiurl + 'h5/#pagesA/mine/invitaScan?uid='+this.moonInfo.uid;
					//this.showQrcode(); //生成二维码
					this.ewmimgurl = retData.ewmimgurl;
					// #endif
					// #ifdef APP-PLUS
					//this.ewmurl = '/pagesA/mine/invitaScan?uid='+this.moonInfo.uid;
					//this.showQrcode(); //生成二维码
					this.ewmimgurl = retData.ewmimgurl;
					// #endif
					// #ifdef MP-WEIXIN
					this.ewmimgurl = retData.ewmimgurl;
					// #endif
					this.$refs.sharePoster.open();
				}
			},
			hidePoster: function() {
				this.$refs.sharePoster.close();
			},
			//保存图片到相册
			doSave(){
				let _this = this;
				uni.showActionSheet({
					itemList:['保存图片到相册'],
					success: () => {
						console.log('图片url:', this.ewmimgurl);
						// uni.showToast({
						// 	title: '图片url:'+this.ewmurl
						// })
						this.isSave = 1;
						//danceuiTool.showToast(this.$refs.toast, '图片url:'+this.ewmurl);
						
						if(1){
							uni.getImageInfo({
								src: this.ewmimgurl,
								success: function(imageObj) {
									console.log('图片信息：', JSON.stringify(imageObj));
									// uni.showToast({
									// 	title: '图片信息：'+JSON.stringify(image)
									// })
									// danceuiTool.showToast(_this.$refs.toast, '图片信息：'+JSON.stringify(image));
									// uni.showModal({
									// 	content: '图片信息:' + JSON.stringify(image),
									// 	showCancel: false
									// })
									
									// if(typeof(image) == "string") {
									// 	var imageObj = JSON.parse(image);
									// }else{
									// 	var imageObj = image;
									// }
									var leixin = typeof(imageObj);
									// uni.showModal({
									// 	content: 'leixin:'+leixin+';path:'+imageObj.path+';width:'+imageObj.width,
									// 	showCancel: false
									// })
									uni.saveImageToPhotosAlbum({
										filePath: imageObj.path,
										success: (res) => {
											console.log('图片保存成功');
											danceuiTool.showToast(_this.$refs.toast, '图片保存成功');
										},
										fail: (err) => {
											uni.showModal({
												content: 'fail:' + JSON.stringify(err),
												showCancel: false
											})
										}
									});
									// plus.gallery.save(imageObj.path, (result) => {
									// 	//console.log(result.file)
									// 	danceuiTool.showToast(_this.$refs.toast, '图片保存成功');
									// } ,(e) => {
									// 	//console.log(e.message)
									// 	uni.showModal({
									// 		content: 'fail:' + JSON.stringify(e),
									// 		showCancel: false
									// 	})
									// });
								},
								fail: (err) => {
									uni.showModal({
										content: 'fail:' + JSON.stringify(err),
										showCancel: false
									})
								}
							});
						}
						
						if(0){
							uni.downloadFile({
								url: this.ewmimgurl, //网络路径，下载下来
								success: (res) => {
									uni.showModal({
										content: 'success,res:' + JSON.stringify(res),
										showCancel: false
									})
									if (res.statusCode === 200) {
										uni.saveImageToPhotosAlbum({
											filePath: res.tempFilePath,
											success: (res) => {
												console.log('图片保存成功');
												danceuiTool.showToast(_this.$refs.toast, '图片保存成功');
												// uni.showToast({
												// 	title: '图片保存成功',
												// 	icon: 'none',
												// 	duration: 2200
												// });
											},
											fail: (err) => {
												uni.showModal({
													content: 'fail:' + JSON.stringify(err),
													showCancel: false
												})
											}
										});
									}
								}
							});
						}
						
						// plus.gallery.save(_this.wxewmurl, function() {
						// 	uni.showToast({
						// 		title:'保存成功',
						// 		icon:'none'
						// 	})
						// }, function() {
						// 	uni.showToast({
						// 		title:'保存失败，请重试！',
						// 		icon:'none'
						// 	})
						// });
					}
				})
			},
			async doCollect() { //请求并获取数据,商品收藏
				const token = uni.getStorageSync('token');
				let headers = {"Authorization":"Bearer "+token};
				var param = {
					pid: this.pid
				};
				let ret = await http.doCollect(this.$refs.toast, param, headers, 1);
				console.log('doCollect操作，获取到的数据：', ret);
				if(ret.code == 200){
					var retData = ret.data;
					if(retData.flag == 1){
						console.log('商品收藏成功');
						this.isCollect = 1;
						uni.showModal({
							cancelText: '关闭',
							confirmText: '查看',
							title: '提示',
							content: retData.msg,
							success: function (res) {
								if (res.confirm) {
									uni.navigateTo({
										url: '/pagesA/mine/myProdCollect'
									});
								} else if (res.cancel) {
								}
							}
						});
					}else if(retData.flag == 2){
						console.log('商品取消收藏成功');
						this.isCollect = 0;
						danceuiTool.showToast(this.$refs.toast, retData.msg, 'success');
					}
				}
			},
			async doFollow(){ //请求并获取数据,店铺关注
				const token = uni.getStorageSync('token');
				let headers = {"Authorization":"Bearer "+token};
				var param = {
					shid: this.shid
				};
				let ret = await http.doFollow(this.$refs.toast, param, headers, 1);
				console.log('doFollow操作,获取到的数据：', ret);
				if(ret.code == 200){
					var retData = ret.data;
					if(retData.flag == 1){
						uni.showModal({
							cancelText: '关闭',
							confirmText: '查看',
							title: '提示',
							content: retData.msg,
							success: function (res) {
								if (res.confirm) {
									uni.navigateTo({
										url: '/pagesA/mine/myShopFollow'
									});
								} else if (res.cancel) {
								}
							}
						});
						this.followShow = '已关注';
					}else if(retData.flag == 2){
						danceuiTool.showToast(this.$refs.toast, retData.msg, 'success');
						if(this.shopInfo.follow_num){
							this.followShow = '+关注'+this.shopInfo.follow_num;
						}else{
							this.followShow = '+关注';
						}
					}
				}
			},
			btnTopMenu(index) {
				console.log('btnTopMenu,index:', index)
				this.closeMenu()
				if (index == 0) {
					uni.switchTab({
						url: '/pages/index/index'
					});
				} else if (index == 1) {
					uni.switchTab({
						url: '/pages/mine/mine'
					})
				} else if (index == 2) {
					uni.switchTab({
						url: '/pages/shopcart/shopcart'
					})
				} else if (index == 3) {
					uni.makePhoneCall({
						phoneNumber: this.shopInfo.phone
					})
				} else if (index == 4) {
					uni.navigateTo({
						url: '/pagesA/feedback/publish'
					})
				} else if (index == 5) {
					this.onShare();
				}
			},
			showEwm() {
				this.modalEwm = true;
			},
			hideEwm() {
				this.modalEwm = false;
			},
			handleClickEwm() {
				this.hideEwm();
			},
			shopCall(){
				uni.makePhoneCall({
					phoneNumber: this.shopInfo.mobile
				})
			},
			coupon() {
				uni.navigateTo({
					url: '../coupon/coupon'
				});
			}
		}
	}
	</script>
	
	<style>
		.cu-modal.swiper-video {
			background: rgba(0, 0, 0, 0.85);
		}
	
		.cu-modal.swiper-video .cu-dialog {
			width: 690upx;
			height: 690upx;
			position: fixed;
			padding: 5upx;
			left: 30upx;
			background: #000;
			border-radius: 10upx;
		}
	
		.cu-modal.swiper-video video {
			width: 680upx;
			height: 680upx;
		}
	
		.ModalClose {
			position: fixed;
			z-index: 1026;
			color: #FFFFFF;
			left: 0;
			right: 0;
			width: 160upx;
			margin: auto;
	
		}
	
		.type-goods {
			display: flex;
			padding-bottom: 15px;
		}
	
		.type-goods .flex-sub {
			padding-left: 10px;
			padding-top: 10px;
		}
	
		.type-goods image {
			width: 120px;
			height: 120px;
			margin-top: -40px;
			border-radius: 3px;
			border: 2px solid #fff;
		}
	
		/*顶部菜单*/
		.tui-dropdown-box {
			width: 100%;
			position: fixed;
			box-sizing: border-box;
			border-bottom-right-radius: 12rpx;
			border-bottom-left-radius: 12rpx;
			transform: translateZ(0);
			overflow: hidden;
			/* visibility: hidden; */
			transition: all 0.3s ease-in-out;
			z-index: 996;
			top: 0;
			background-color: rgba(76, 76, 76, 0.95);
			transform: translateZ(0px) translateY(0px);
		}
	
		.tui-menu-box {
			box-sizing: border-box;
			padding: 74rpx 30rpx 20rpx;
		}
	
		.tui-menu-header {
			font-size: 34rpx;
			color: #fff;
			height: 48rpx;
			align-items: center;
		}
	
		.tui-menu-itembox {
			color: #fff;
			padding: 40rpx 10rpx 0 10rpx;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			font-size: 26rpx;
		}
	
		.tui-menu-item {
			width: 22%;
			height: 160rpx;
			border-radius: 24rpx;
			display: flex;
			align-items: center;
			flex-direction: column;
			justify-content: center;
			background: rgba(0, 0, 0, 0.4);
			margin-right: 4%;
			margin-bottom: 4%;
		}
	
		.tui-menu-item:nth-of-type(4n) {
			margin-right: 0;
		}
	
	.tui-badge-box{position:relative}
	.tui-badge-box .iconfontzz{color:#fff;font-size:42rpx}
	.tui-badge-box .daui-badge{background-color:#F74D54 !important;color:#fff;height:30rpx;line-height:30rpx;min-width:30rpx;padding:0 6rpx;top:-4rpx;right:-12rpx;position:absolute;transform:scale(0.8) translateX(0px);margin:0px}
	
		.tui-msg-badge {
			top: -10px;
		}
	
		.tui-icon-up_box {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.tui-icon-up_box .iconfontzz{color: #fff;font-size: 32px;}
	
		.tui-menu-text {
			padding-top: 12rpx;
		}
	
		.tui-opcity .tui-menu-text,
		.tui-opcity .tui-badge-box {
			opacity: 0.5;
			transition: opacity 0.2s ease-in-out;
		}
	
	/*顶部菜单*/
		
	/*图片轮播*/
	.swiper-box{width:100%;padding:0;position: relative;}
	.swiper-tag{position: absolute;bottom: 15px;right: 0;}
	.swiper-tag .daui-badge{background-color: rgba(0, 0, 0, 0.6);color: #FFFFFF;padding: 12rpx 18rpx;height: inherit;line-height: inherit;border-radius: 26px 0 0 26px;}
	
	/*商品头部*/
	.goods-head{margin-top: 0;}
	.goods-price{padding: 10rpx 0;}
	.goods-price .goods-real-price{font-size:48rpx}
	.goods-price .origin-price{margin: 0 12rpx;color: #909399;text-decoration: line-through;}
	.goods-stock{line-height: 40rpx;font-size: 24rpx;color: #909399;}
	
	/*商品参数*/
	.goods-parameter .daui-cell__hd{color: #888888;}
	.goods-parameter .daui-cell__bd{color: #f6c133;}
	
	/*商品内容*/
	.goods-cont-title{display:flex;justify-content:center;align-items:center;height:80upx;font-size:$font-base + 2upx;color:$font-color-dark;position:relative}
	.goods-cont-title text{padding:0 20upx;background:#fff;position:relative;z-index:1}
	.goods-cont-title:after{position:absolute;left:50%;top:50%;transform:translateX(-50%);width:300upx;height:0;content:'';border-bottom:1px solid #ccc}
	
	.goods-content{}
	.goods-content image{max-width: 100%;display: block;min-height: 100px;background-color: #FFFFFF;}
	
	/*海报二维码*/
	.poster-box{text-align: center;}
	.poster-box .poster-box-hd{}
	.poster-box .poster-box-hd .poster-img{width:60%;margin: 0 auto;}
	.poster-box .poster-box-bd{display: flex;justify-content: center;padding: 80rpx 0;}
	
	/*底部条*/
	.daui-tabbar.daui-tabbar-cart .daui-tabbar__hd{width: 104rpx;}
	.daui-tabbar.daui-tabbar-cart .daui-tabbar__hdbtn{width: 380rpx;}
	.daui-tabbar.daui-tabbar-cart image{}
	.daui-tabbar.daui-tabbar-cart .iconfontzz{margin-bottom: 10rpx;}
	</style>
	